#include <stdio.h>

#define TRACE(x...) 
#define PRINT(x...) TRACE(printf(x))

int n;
int str[50];
int cont;
int bits;

int main() {
	while (1) {
		scanf("%d", &n);
		if (!n) break;

		str[0]=n;
		cont=1;

		while (n>1) {
			for (int i=0; i<32; i++)
				if ((1<<i) & n) {
					bits=i;
				}

			//PRINT("%d %d\n", n, bits);
			
			n=bits;
			str[cont++]=n;
		}

		TRACE(
			for (int i=0; i<cont; i++)
				printf("%d ", str[i]);
			printf("\n");
		)

		cont--;
		printf("0");

		for (int i=cont-1; i>=0; i--) {
			for (int j=0; j<32; j++)
				if ((1<<j) & str[i]) bits=j;

			for (int j=bits; j>=0; j--)
				if (1<<j & str[i]) printf("1");
				else printf("0");
		}

		printf("\n");
	}

	return 0;
}
